<?php
	class Search_model extends CI_Model{
		var $table	=	"articles";
		var $table_question = "ans_question";
		
		function __construct(){
			parent::__construct();
		}
		
		function get(){
          	$res	=	$this->db->select('id, title, title_link, text, description')
          						 ->limit(40)
          						 ->get($this->table)	
          						 ->result_array();
          	return $res;
          						 
        }
        
        function get_detail($id){
        	$detail = $this->db->select()
        						->where('id', $id)
        						->get($this->table_question)
        						->row_array();
        	return $detail;
        						
        }
		
        
        function get_detail_by_title($title){
        	return $res = $this->db->select()->where('brief_ascii', $title)->get($this->table_question)->row_array();
        }
		
	}